import {createApp} from 'vue'
import './style.css'
import App from './App.vue'
import router from "./router";
import Antd from 'ant-design-vue';
import microApp from '@micro-zoe/micro-app'
import 'ant-design-vue/dist/antd.css';
import '@/styles/index.scss'
const app = createApp(App)
app.use(router)
app.use(Antd)
microApp.start({
    plugins: {
        modules: {
            "appname-vite": [
                {
                    loader(code) {
                        if (process.env.NODE_ENV === "development") {
                            // 这里 /basename/ 需要和子应用vite.config.js中base的配置保持一致
                            code = code.replace(
                                /(from|import)(\s*['"])(\/child\/vite\/)/g,
                                (all) => {
                                    return all.replace(
                                        "/child/vite/",
                                        "http://localhost:4007/child/vite/"
                                    );
                                }
                            );
                        }
                        return code;
                    },
                },
            ],
        },
    },
});

app.mount('#base-app')
